#ifndef CGAMEMANAGER_H_INCLUDED
#define CGAMEMANAGER_H_INCLUDED

#include "LON.h"

#define SHOW_GRID 1
#define DRIVER_TYPE EDT_OPENGL
#define FULLSCREEN 0
#define SCREEN_W 800
#define SCREEN_H 600
#define GAME_TITLE L"Lord of Netherworld"

class CNetworkManager;
class CEventReceiver;
class CState;
class CChatBox;
class COverlord;

//! CGameManager
class CGameManager {
  public:
    bool run();   // This is main loop;

    void pushState(CState * state);
    void popState();

    //! Sets
    void                setPlayer(COverlord *player);
    void                setPlayerID(u32 playerID);

    //! Gets
    IrrlichtDevice*     getDevice() { return device; }
    ISceneManager*      getSceneManager() { return smgr; }
    IGUIEnvironment*    getGUIEnv() { return env; }
    IVideoDriver*       getDriver() { return driver; }
    CState*             getState()  { return *stateStack.getLast(); }
    CNetworkManager*    getNetworkManager() { return net; }
    CChatBox*           getChatBox() { return chat; }
    u32                 getPlayerID() { return playerID; }
    COverlord*          getPlayer() { return player; }
    IAttributes*        getConfig() { return config; }

    CGameManager();
    ~CGameManager() { };


  //! private variables
  protected:
    IrrlichtDevice  *device;
    ISceneManager   *smgr;
    IGUIEnvironment *env;
    IVideoDriver    *driver;
    CEventReceiver  *receiver;
    CNetworkManager *net;
    CChatBox        *chat;

    IAttributes     *config;

    COverlord       *player;
    u32             playerID;

    list <CState*> stateStack;
};

#endif // CGAMEMANAGER_H_INCLUDED
